<%= stylesheet_link_tag 'product_backlogs' %>

<nav id="productBacklogMenu" class="subMenu">
	Projekt w&auml;hlen <%= select("project_to_user", "project_id", ProjectToUser.find_all_by_user_id(current_user.id).collect{|u| [Project.find_by_id(u.project_id).name, u.project_id]}, :selected => current_user.current_project_id) %>
	<span class="subMenuPipe"></span>
	<a href="javascript:void(null)" id="addUserStory"><%= image_tag("layout/Create.png", :id => "createIcon", :alt => "Eine User Story hinzuf&uuml;gen", :class => "icon") %></a>
	<span class="subMenuPipe"></span>
	<a href="javascript:void(null)" id="chooseModus"><%= image_tag("layout/System.png", :id => "chooseModeIcon", :alt => "In den Auswahlmodus wechseln", :class => "icon") %></a>
	<a href="javascript:void(null)" id="deleteUserStory"><%= image_tag("layout/Erase.png", :id => "eraseIcon", :alt => "Die ausgew&auml;hlte(n) User Story/Stories l&ouml;schen", :class => "icon") %></a>
	<a href="javascript:void(null)" id="addUserStoryToSprintBacklog"><%= image_tag("layout/Forward.png", :id => "forwardIcon", :alt => "Die ausgew&auml;hlte(n) User Story/Stories dem Sprintbacklog hinzuf&uuml;gen", :class => "icon") %></a>
	<span class="subMenuPipe"></span>
	Filtern <%= select("userstory", "user_story_state_pid", @story_states, {include_blank: 'Alle anzeigen'}) %>
        Sortieren <%= select("userstory", "sort_option", [["Priorität", 0], ["Erstellt am",1], ["Geändert am",2], ["Status",3], ["Rating",4], ["ID",5]]) %>
	<span class="subMenuPipe"></span>
	<a href="javascript:void(null)" id="showHideKey"><%= image_tag("layout/Information.png", :id => "keyIcon", :alt => "Die Legende ausblenden", :class => "icon") %></a>
	<a href="javascript:void(null)" id="showHideChart"><%= image_tag("layout/About.png", :id => "chartIcon", :alt => "Das Chart ausblenden", :class => "icon") %></a>
	<span class="subMenuPipe"></span>
</nav>

<%= render :partial => "linechart" %>

<div id="wrapChart"></div>

<div id="wrapProductBacklog">
	<div id="productBacklog">
		<div id="keys">
                    <% @story_states.each do |state, id| %>
                        <nobr><span class="key status_<%= id %>"></span> <%= raw state %></nobr>
                    <% end %>
		</div>
		<div id="userStories">
			<%= render :template => 'user_stories/show' %>
		</div>
	</div>	
</div>
	
<div id="wrapUserStoryDetail">
    <div id="userStoryDetail">
        <script>
            $(document).ready(function(){
                if($("#productBacklog #userStories .userStory").length > 0){
	                user_story_to_load = $("#productBacklog #userStories .userStory").first();
	                user_story_to_load.addClass("marked");
	
	                id = user_story_to_load.attr("id").match(/[0-9]+/);
	
	                $("#userStoryDetail").load("../user_stories/edit?id=" + id);	
                }
            });
        </script>
        <h3>Detail-Ansicht</h3>
        <p>Lade ...</p> 
    </div>
</div>
